
package gui.panels;

import gui.MainFrame;
import gui.listeners.GuiActionEvent;
import gui.listeners.GuiActionEventType;
import gui.model.DrinkModel;
import gui.panels.components.MmiButton;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

/**
 *
 * @author JtR
 */
public class SelectBeansPanel extends GuiPanel {
    private MmiButton arabicaButton, robustaButton;
    
    public SelectBeansPanel(MainFrame parent) {
        super(parent, BackgroundType.COFFEE);
    }
    
    @Override
    protected void initComponents() {        
        arabicaButton = new MmiButton("res/kaffeepause/Arabica.png", 350);
        arabicaButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                fireGuiActionEvent(new GuiActionEvent(GuiActionEventType.CHOSE_ARABICA));
            }
        });
        constraints.insets = new Insets(120, 200, 0, 0);
        add(arabicaButton, constraints);
        
        robustaButton = new MmiButton("res/kaffeepause/robusta.png", 350);
        robustaButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                fireGuiActionEvent(new GuiActionEvent(GuiActionEventType.CHOSE_ROBUSTA));
            }
        });
        constraints.insets = new Insets(20, 500, 0, 0);
        add(robustaButton, constraints);
    }

    @Override
    public String getDescription() {
        return "Möchten Sie Arabica- oder Robustabohnen?";
    }

    @Override
    public void updateFields() {
    }

    @Override
    public boolean getPreviousButtonEnabled() {
        return true;
    }

    @Override
    public boolean getNextButtonEnabled() {
        return DrinkModel.getInstance().getBean()!= null;
    }

    @Override
    public String getName() {
        return "BEANS_NAME";
    }

    @Override
    public GuiPanel getNextPanel() {
        if(DrinkModel.getInstance().getCoffee() == DrinkModel.Coffee.BLACK_COFFEE) {
            return parent.selectCoffeeAdditionsPanel;
        } else {
            return parent.selectCappuchinoAdditionsPanel;
        }
    }

    @Override
    public GuiPanel getPreviousPanel() {
        return parent.selectSizePanel;
    }
}
